package com.hs.egova.util;

/**
 * @author husheng
 * @version v1.0
 * @date 2021/7/27 15:23
 * @email husheng@egova.com.cn
 */
public class ResourcePoolConfigNew {

    private String name;

    private int maxTotal;

    private int maxIdel;

    private int minIdel;

    public String getName() {
        return name;
    }

    public int getMaxTotal() {
        return maxTotal;
    }


    public int getMaxIdel() {
        return maxIdel;
    }


    public int getMinIdel() {
        return minIdel;
    }


    ResourcePoolConfigNew(Builder builder) {
        this.name = builder.name;
        this.maxIdel = builder.maxIdel;
        this.minIdel = builder.minIdel;
        this.maxTotal = builder.maxTotal;
    }
    public static ResourcePoolConfigNew.Builder builder() {
        return new ResourcePoolConfigNew.Builder();
    }
    public static class Builder {
        private static final int DEFAULT_MAX_TOTAL = 8;
        private static final int DEFAULT_MAX_IDLE = 8;
        private static final int DEFAULT_MIN_IDLE = 0;

        private String name;
        private int maxTotal = DEFAULT_MAX_TOTAL;
        private int maxIdel = DEFAULT_MAX_IDLE;
        private int minIdel = DEFAULT_MIN_IDLE;

        public ResourcePoolConfigNew build() {
            return new ResourcePoolConfigNew(this);
        }
        public Builder name(String name) {
            /**
             * 业务逻辑判断省略
             */
            this.name = name;
            return this;
        }
        public Builder maxTotal(int maxTotal) {
            /**
             * 业务逻辑判断省略
             */
            this.maxTotal = maxTotal;
            return this;
        }

        public Builder maxIdel(int maxIdel) {
            /**
             * 业务逻辑判断省略
             */
            this.maxIdel = maxIdel;
            return this;
        }
        public Builder minIdel(int minIdel) {
            /**
             * 业务逻辑判断省略
             */
            this.minIdel = minIdel;
            return this;
        }
    }
}
